* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  background-color: #dcdcdc;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

main {
  display: flex;
  gap: 10px;
}

main > section {
  width: 150px;
  height: 200px;
  position: relative;
}

main > p::after {
  content: ":";
  display: block;
  width: 50px;
  height: 200px;
  font: bold 200px arial;
  text-align: center;
  line-height: 200px;
}

main > section > div {
  position: absolute;
}
main > section > div::before, main > section > div::after {
  display: block;
  border-radius: 5px;
  width: 150px;
  height: 100px;
  text-align: center;
  font: bold 200px arial;
  overflow: hidden;
  color: #000;
}
main > section > div::before {
  content: attr(data-before);
  line-height: 200px;
}
main > section > div::after {
  content: attr(data-before);
  line-height: 0;
}

main > section > div:nth-child(2) {
  opacity: 0;
  width: 150px;
  height: 100px;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  transition: 0.5s;
  transform-origin: bottom;
}
main > section > div:nth-child(2)::before {
  transform: rotateX(180deg);
  line-height: 0;
}
main > section > div:nth-child(2)::after {
  transform: translateY(-100%);
  line-height: 200px;
}

main > section {
  perspective: 100px;
}

main > section > div:nth-child(2).flipDown {
  animation-name: flipDown;
  animation-duration: 0.6s;
  animation-fill-mode: both;
}

@keyframes flipDown {
  to {
    transform: rotateX(-180deg);
  }
}